package com.vehicle.repair.model;

import jakarta.persistence.*;
import lombok.Data;

@Entity
@Table(name = "Order_Assignment")
@Data
@IdClass(OrderAssignmentId.class)
public class OrderAssignment {
    @Id
    @ManyToOne
    @JoinColumn(name = "order_id", nullable = false)
    private WorkOrder order;
    
    @Id
    @ManyToOne
    @JoinColumn(name = "repairer_id", nullable = false)
    private Repairer repairer;
    
    private Boolean accepted = false;
}

class OrderAssignmentId implements java.io.Serializable {
    private Integer order;
    private Integer repairer;
    
    public OrderAssignmentId() {}
    
    public OrderAssignmentId(Integer order, Integer repairer) {
        this.order = order;
        this.repairer = repairer;
    }
    
    // equals and hashCode methods
}
